package com.xu.provider.dao;

import com.xu.dto.CardDto;
import com.xu.entity.Card;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 徐老板
 * @date 2020/3/31   10:49
 */
public interface CardDao {
    //查询
    @Select("select * from t_card where phone =#{phone}")
    Card selectByPhone(String phone);

    //新增  这边有意思的是把前端没有补全的内容在这里补全了 之前都是在业务层
    @Insert("insert into t_card(name,email,info,phone,address,position,blogurl,ctime,flag) " +
            "values(#{name},#{email},#{info},#{phone},#{address},#{position},#{blogurl},now(),1)")
    int insert(CardDto cardDto);

    @Select("select * from t_card order by ctime desc ")
    List<Card> selectAll();
}
